﻿using FreeSql.DataAnnotations;
using MySqlX.XDevAPI.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZhonTai.Admin.Core.Entities;
using ZhonTai.Industry.Domain.ProductModel;
using ZhonTai.Industry.Domain.WorkStation;

namespace ZhonTai.Industry.Domain.WorkParamRecord
{
    /// <summary>
    /// 工作参数记录
    /// </summary>
    /// <remarks>工作参数记录</remarks>
    [Table(Name = "prd_work_param_record_{yyyyMM}", AsTable = "CreatedTime=2025-5-1(1 month)")]
    [Index("idx_station_created_result", nameof(StationId) + "," + nameof(CreatedTime) + "," + nameof(Status))]
    public class WorkParamRecordEntity : EntityBase
    {
        /// <summary>
        /// 产品编号
        /// </summary>
        /// <remarks>产品编号</remarks>
        public string? ProductCode { get; set; }

        /// <summary>
        /// 工站Id
        /// </summary>
        /// <remarks>工站Id</remarks>
        public long StationId { get; set; }

        /// <summary>
        /// 订单Id
        /// </summary>
        /// <remarks>订单Id</remarks>
        public long? OrderId { get; set; }

        /// <summary>
        /// 产品Id
        /// </summary>
        /// <remarks>订单Id</remarks>
        public long? ProductModelId { get; set; }

        /// <summary>
        /// 工艺名称
        /// </summary>
        /// <remarks>工艺名称</remarks>
        public string? ParameterName { get; set; }

        /// <summary>
        /// 工艺参数
        /// </summary>
        /// <remarks>工艺参数</remarks>
        public string? ParameterValue { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        /// <remarks>单位</remarks>
        public string? Unit { get; set; }

        /// <summary>
        /// 上限值
        /// </summary>
        /// <remarks>上限值</remarks>
        public decimal UpperLimit { get; set; }

        /// <summary>
        /// 下限值
        /// </summary>
        /// <remarks>下限值</remarks>
        public decimal LowerLimit { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        /// <remarks>状态</remarks>
        public string? Status { get; set; }

        /// <summary>
        /// 上传标识
        /// </summary>
        /// <remarks>上传标识</remarks>
        public bool Upload { get; set; }

        /// <summary>
        /// 工站
        /// </summary>
        [Navigate(nameof(StationId))]
        public WorkStationEntity WorkStation { get; set; }

        /// <summary>
        /// 产品类型
        /// </summary>
        [Navigate(nameof(ProductModelId))]
        public ProductModelEntity ProductModel { get; set; }
    }
}